﻿<ng-include src="'./includes/header.html'"></ng-include>

<div class="main">
    <div class="container">
		<div class="row">
			<div class="widget stacked">	
				<div class="widget-header">
					<i class="icon-bookmark"></i>
					<h3>{{ 'SHORTCUTS' | i18n }}</h3>
				</div> <!-- /widget-header -->
				<div class="widget-content">
					<div class="shortcuts">
						<a href="javascript:;" class="shortcut" ng-click="vm.actionStart()" ng-show="vm.CanStart">
							<i class="shortcut-icon icon-play"></i>
							<span class="shortcut-label">{{ 'START' | i18n }}</span>
						</a>
						<a href="javascript:;" class="shortcut" ng-click="vm.actionStop()" ng-show="vm.CanStop">
							<i class="shortcut-icon icon-stop"></i>
							<span class="shortcut-label">{{ 'STOP' | i18n }}</span>
						</a>
						<a href="javascript:;" class="shortcut" ng-click="vm.actionUpdate()" ng-show="vm.CanUpdate">
							<i class="shortcut-icon icon-refresh"></i>
							<span class="shortcut-label">{{ 'UPDATE' | i18n }}</span>
						</a>
					</div> <!-- /shortcuts -->	
				</div> <!-- /widget-content -->
			</div> <!-- /widget -->
			<div class="row">
      	<div class="span6">
      		<div class="widget stacked">	
				<div class="widget-header">
					<i class="icon-star"></i>
					<h3>{{ 'SERVERINFO' | i18n }}</h3>
				</div> <!-- /widget-header -->
				<div class="widget-content">
				<form class="form-horizontal" role="form">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">{{ 'SERVERID' | i18n }}</label>
                        <div class="col-sm-3">
                            <span class="form-control input-xlarge uneditable-input">{{ server.server_id }}</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">{{ 'SERVERNAME' | i18n }}</label>
                        <div class="col-sm-9">
                            <input type="text" ng-show="user.role >= 8" id="name" class="form-control input-xlarge" placeholder=" server name" ng-model="server.name">
                            <span ng-show="user.role < 8" class="form-control input-xlarge uneditable-input">{{ server.name }}</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">{{ 'PORTNUMBER' | i18n }}</label>
                        <div class="col-sm-9">
                            <input type="text" ng-show="user.role >= 8" id="server_port" class="form-control input-xlarge" placeholder=" server port" ng-model="server.server_port">
                            <span ng-show ="user.role < 8" class="form-control input-xlarge uneditable-input">{{ server.server_port }}</span>
                        </div>
                    </div>
                    <div class="form-group" ng-show="user.role >= 8">
                        <label class="col-sm-3 control-label">{{ 'EXECUTABLE' | i18n }}</label>
                        <div class="col-sm-9">
                            <input type="text" id="executable" class="form-control input-xlarge" placeholder=" server executable" ng-model="server.executable">
                        </div>
                    </div>
                    <div class="form-group" ng-show="user.role >= 8">
                        <label class="col-sm-3 control-label">{{ 'SERVERPATH' | i18n }}</label>
                        <div class="col-sm-9">
                            <input type="text" id="path" class="form-control input-xlarge" placeholder=" server path" ng-model="server.path">
                        </div>
                    </div>
                    <div class="form-group" ng-show="user.role >= 8">
                        <label class="col-sm-3 control-label">{{ 'CONFIGPATH' | i18n }}</label>
                        <div class="col-sm-9">
                            <input type="text" id="config_path" class="form-control input-xlarge" placeholder=" server config path" ng-model="server.config_path">
                        </div>
                    </div>
                    <div class="form-group" ng-show="user.role >= 8">
                        <label class="col-sm-3 control-label">{{ 'TEMPLATEPATH' | i18n }}</label>
                        <div class="col-sm-9">
                            <input type="text" id="template_path" class="form-control input-xlarge" placeholder=" server template path" ng-model="server.template_path">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">{{ 'LASTACTION' | i18n }}</label>
                        <div class="col-sm-9">
                            <span class="form-control input-xlarge uneditable-input">{{ server.last_datetime }}</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">{{ 'STATUS' | i18n }}</label>
                        <div class="col-sm-9">
                            <span ng-show="server.is_started" class="label label-success"><span class="icon icon-refresh">  {{ 'RUNNING' | i18n }}</span></span>
                            <span ng-show="server.is_stopped" class="label label-info"><span class="icon icon-stop">  {{ 'STOPPED' | i18n }}</span></span>
                            <span ng-show="server.is_updating" class="label label-important"><span class="icon icon-wrench">  {{ 'UPDATING' | i18n }}</span></span>
                            <span ng-show="server.is_stopping" class="label label-warning"><span class="icon icon-arrow-down">  {{ 'STOPPING' | i18n }}</span></span>
                            <span ng-show="server.is_starting" class="label label-warning"><span class="icon icon-arrow-up">  {{ 'STARTING' | i18n }}</span></span>
                      </div>
                    </div>
                </form>
            <div class="col-sm-2">
                <button type="button" class="btn btn-block" ng-click="vm.getServer()"><span class="glyphicon glyphicon-refresh"></span> {{ 'REFRESH' | i18n }}</button>
            </div>
				</div> <!-- /widget-content -->	
			</div> <!-- /widget -->	
		</div> <!-- /span6 -->
		
      	<div class="span6">
      		<div class="widget stacked">	
				<div class="widget-header">
					<i class="icon-star"></i>
					<h3>{{ 'SERVERCONFIG' | i18n }}</h3>
				</div> <!-- /widget-header -->
				<div class="widget-content">
				<form class="form-horizontal" name="configsForm" role="form">
            <div class="row">
                <div class="col-sm-10">
                    <div class="form-group" ng-repeat="config in server.configs" ng-show="config.is_visible == null || config.is_visible">
                        <label class="col-sm-2 control-label">{{ config.name | i18n }}</label>
                        <div class="col-sm-offset-1 col-sm-9">
                            <input type="text" class="form-control " id="config_{{ config.config_id }}" ng-disabled="config.is_writable != null && !config.is_writable && user.role < 8" ng-model="config.value">
                            <a class="btn btn-danger" ng-show="user.role >= 8" ng-click="vm.deleteConfig(config.config_id)"><span class="icon-remove"></span></a>
                        </div>
                    </div>
                </div>
                <div class="col-sm-2" ng-show="user.role >= 2">
                    <button type="button" class="btn btn-block" ng-click="vm.applyConfig()" ng-show="configsForm.$dirty"><span class="glyphicon glyphicon-floppy-save"></span> {{ 'APPLY' | i18n }}</button>
                    <br />
                    <button type="button" class="btn btn-block" ng-click="vm.resetConfig()" ng-show="configsForm.$dirty"><span class="glyphicon glyphicon-repeat"></span> {{ 'RESET' | i18n }}</button>
                </div>
            </div>
        </form>
        <div class="panel-footer">
            <form class="form-inline" role="form" ng-show="user.role >= 8">
                <label class="col-sm-3 control-label">{{ 'NEWCONFIG' | i18n }}</label>
                <div class="form-group">
                    <input type="text" id="new_config_name" class="input-medium" placeholder="{{ 'NEWCONFIGNAME' | i18n }}" ng-model="newconfig.name">
                </div>
                <div class="form-group">
                    <input type="text" id="new_config_name" class="input-large" placeholder="{{ 'NEWCONFIGVAL' | i18n }}" ng-model="newconfig.value">
                </div>
                <div class="form-group">
                    <button type="button" ng-click="vm.addConfig()" ng-show="newconfig.value.length > 0 && newconfig.name.length > 0" class="btn btn-xs"><span class="glyphicon glyphicon-floppy-save"></span> {{ 'ADD' | i18n }}</button>
                </div>
            </form>
        </div>
				</div> <!-- /widget-content -->	
			</div> <!-- /widget -->	
		</div> <!-- /span6 -->
      </div> <!-- /row -->
			
		</div>
	</div>
</div>


